package com.gitee.huanminabc.utils_tools.config_refresh.file;

import com.gitee.huanminabc.utils_tools.config_refresh.enums.ConfigFileTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Properties;

@Component
public class ConfigFileReadFactory {
    @Autowired
    private List<ConfigFileRead> configFileReads;


    public Properties getRead(ConfigFileTypeEnum fileType) throws Exception {
        for (ConfigFileRead configFileRead : configFileReads) {
            if (configFileRead.fileType().equals(fileType)) {
                return configFileRead.read();
            }
        }
       throw new RuntimeException("未找到对应的文件读取器");
    }

}
